home *** CD-ROM | disk | FTP | other *** search
/ Enter Special 2004 January: Practical Advice / ENTER Special 09.iso / Biuro / NoteTab Light 4.95 / NoteTab_Setup.exe / {app} / Libraries / SampleCode.clb < prev    next >
Encoding:
Text File  |  2003-05-22  |  21.6 KB  |  608 lines

  1. = V5 MultiLine NoSorting TabWidth=30
  2.  
  3. H=";About this library"
  4. This library was written by Fookes Software to serve as a demonstration of the varied tasks that can be performed by the Editor Clipbook. It contains various items that illustrate how certain Clip commands and functions can be used. Most of these Clips do not really provide useful functions, but they can help you understand how to create your own Clips. We recommend that you look at the Clip code and compare it with what happens when you activate it.
  5.  
  6. If you have a useful Clipbook library that you would like to share with other NoteTab users, please submit it to: <clipbook@fookes.com>. Your library will then be added to the Clipbook repository on the web.
  7.  
  8.  
  9. H=";"
  10.  
  11.  
  12. H=";Launching Programs"
  13.  
  14.  
  15. H="Batch example"
  16. ^!Continue This Clip will first launch the Windows calculator; once you close it, MS Wordpad will be opened. Continue?
  17. ;Launches the calculator utility and waits until the user closes it
  18. ^!ShellWait calc.exe
  19. ;Launches the Wordpad program
  20. ^!Shell Wordpad.exe ^$GetShort("^##")$
  21.  
  22. H="Shortcut example"
  23. ;Executes application associated with the shortcut
  24. ^!Prompt This Clip example will only work if you have a shortcut labeled "Explorer" pointing to Windows Explorer on your Desktop.
  25. ^!Shell ^$GetShellFolder(Desktop)$explorer.lnk
  26.  
  27. H="Send E-Mail"
  28. ;Demonstrates the ^!EMail command
  29. ^!EMail ^?[E-mail address];^?[E-mail subject=^&]^?[Copy text from active document to E-mail body?=_Yes^=;+|No^=;]
  30.  
  31. H="Launch Document"
  32. ;Opens the current document in its associated application (for example .html file opens in default browser). A temporary copy of the document is made if it wasn't saved before using the "^**" instruction
  33. ^!Shell "^**"
  34.  
  35. H=";"
  36.  
  37.  
  38. H=";Updating INI options"
  39.  
  40.  
  41. H="1. ProgIniSave"
  42. ;Saves current settings to the "Test.ini" file in the NoteTab program directory (default when no path is specified)
  43. ^!ProgIniSave Test.ini
  44.  
  45. H="2. ProgIniEdit"
  46. ;Check if the file "Test.ini" exists. If it does, skip the next instruction, otherwise create it and save the NoteTab settings to it
  47. ^!IfFileExist ^$GetAppPath$Test.ini Skip
  48. ;Saves current settings to the "Test.ini" file in the NoteTab program directory (default when no path is specified)
  49. ^!ProgIniSave Test.ini
  50. ;Open the "Test.ini" file in NoteTab
  51. ^!Open ^$GetAppPath$Test.ini
  52. ;Show message
  53. ^!Prompt Edit items in the Test.ini file, save the changes, and then activate on the Clip "3. ProgIniLoad" to update NoteTab option settings
  54.  
  55. H="3. ProgIniLoad"
  56. ;Update NoteTab settings with options contained in the "Test.ini" file
  57. ^!ProgIniLoad Test.ini
  58.  
  59. H=";"
  60.  
  61.  
  62. H=";Scripts"
  63.  
  64.  
  65. H="Perl script"
  66. ;Check if a Perl interpreter has been setup. If not, jump to the label NoPerl
  67. ^!IfFileExist ^$GetPerlExe$ Next ELSE NoPerl
  68. ;Delete the file "StdError.err" from the NoteTab program directory, if it exists
  69. ^!DeleteFile ^$GetAppPath$StdError.err
  70. ;Execute the Perl interpreter with the script contained in the Clip labeled "NumLines"
  71. ^!RunPerl Perl NumLines
  72. ;If the interpreter generated error messages, load them from the file "StdError.err" 
  73. ^!IfFileExist ^$GetAppPath$StdError.err Next ELSE End
  74. ^!Open ^$GetAppPath$StdError.err
  75. ^!Prompt Perl has reported some errors!
  76. ^!GoTo End
  77. :NoPerl
  78. ^!Prompt Cannot execute this Clip without a Perl interpreter!
  79.  
  80.  
  81. H="Gawk scripts"
  82. ;Thanks to Wayne M. VanWeerthuizen for the GAWK samples used by this Clip!
  83. ;Check if a Gawk interpreter has been setup. If not, jump to the label Error
  84. ^!IfFileExist ^$GetGawkExe$ Next ELSE Error
  85. ;Prompt user for the script to use with the Gawk interpreter and save answer in a variable
  86. ^!Set %ScriptName%=^?{(T=C)Choose GAWK script to modify document==_Reverse|Add Spaces}
  87. ;Abort this procedure if the Clip wizard was cancelled by the user
  88. ^!IfCancel Exit
  89. ;Execute the Gawk interpreter with the chosen script
  90. ^!RunGawk ^%ScriptName%
  91. ^!GoTo End
  92. :Error
  93. ^!Prompt Cannot execute this Clip without a GAWK interpreter!
  94.  
  95.  
  96. H="_Reverse"
  97. # Reverse text
  98. BEGIN { FS = "" }
  99. {
  100. for (i=NF;i>0;i--) printf("%s",$i);
  101. printf("\n");
  102. }
  103.  
  104.  
  105.  
  106. H="_Add Spaces"
  107. # Add spaces
  108. BEGIN { FS = "" }
  109. {
  110. for (i=1;i<NF;i++) printf("%s ",$i);
  111. printf("%s\n",$NF);
  112. }
  113.  
  114.  
  115.  
  116. H="_Perl NumLines"
  117. #
  118. #รก \perl\numline.pl
  119. #
  120. # begin
  121. while (<>) {
  122.     $x=sprintf("%05d",$.);
  123.     print "$x $_";
  124. }
  125. # end
  126.  
  127.  
  128. H=";"
  129.  
  130.  
  131. H=";Keyboard Macros"
  132.  
  133.  
  134. H="Show text statistics"
  135. ;Press key combination Alt+T, followed by the letter S, followed by a delay of 400 milliseconds to give the dialog box time to open, followed by the letter M
  136. ^!Keyboard ALT+T S &400 M
  137.  
  138. H="Open AutoExec.bat"
  139. ;Set delay of approximately 200 milliseconds between each keystroke
  140. ^!KeyboardDelay 200
  141. ;Press key combination Ctrl+O (opens the File Open dialog box), followed by the text "c:\autoexec.bat", followed by the Enter key (to close the dialog box)
  142. ^!Keyboard CTRL+O #c:\autoexec.bat# ENTER
  143.  
  144. H="Use Windows Calculator"
  145. ;The following script shows how you can send keys to another program
  146.  
  147. ;Check if the calculator program is open. Jumpt to BringToFront label if found
  148. ^!IfAppOpen Calculator BringToFront ELSE Next
  149. ;Calculator program was not open, so now we launch it
  150. ^!Shell Calc.exe
  151. ;give it enough time to load (4/10th of a second)
  152. ^!Delay 4
  153.  
  154. :BringToFront
  155. ;Bring Calculator program to the front
  156. ^!FocusApp Calculator
  157.  
  158. :PressKeys
  159. ;Add all numbers from 1 to 9 and then activate the equal button with the ENTER key
  160. ;Set delay of approximately 200 milliseconds between each keystroke
  161. ^!KeyboardDelay 200
  162. ;Send keystrokes to the calculator utility
  163. ^!Keyboard #1+2+3+4+5+6+7+8+9# ENTER
  164.  
  165.  
  166. H=";"
  167.  
  168.  
  169. H=";Wizard Fields"
  170.  
  171.  
  172. H="Remember variable"
  173. ;Show message
  174. ^!Info This Clip shows you how variables can be used in the Clip wizard and reused as default values in the dialog box's fields. The value of the variables will be inserted into the current document (unless you cancel the Clip wizard). The Clip wizard will be displayed repeatedly until you click on the Cancel button.
  175. ;Place cursor at the end of the document
  176. ^!Jump TEXT_END
  177.  
  178. :StartLoop
  179. ;Show Clip wizard with two fields. Each receives the default value contained in the variable following the label's equal sign
  180. ^!Set %p_FName%=^?{First Name=^%p_FName%}; %p_LName%=^?{Last Name=^%p_LName%}
  181. ;Abort this procedure if the Clip wizard was cancelled by the user
  182. ^!IfCancel Exit
  183. ;Insert text and variable content into document
  184. First Name: ^%p_FName%
  185. Last Name:  ^%p_LName%
  186.  
  187.  
  188. ;Jump back to the start of the loop
  189. ^!Goto StartLoop
  190.  
  191. H="Remember default value"
  192. ;Create a new document
  193. ^!ToolBar New Document
  194.  
  195. ;If the variable ValueList is not empty, skip the next instruction
  196. ^!IfFalse ^$IsEmpty(^%ValueList%)$ Skip
  197. ;Assign a list of values to the variable ValueList
  198. ^!Set %ValueList%=_1|2|3|4|5|6
  199.  
  200. ;Beginning of loop
  201. :StartLoop
  202. ;Promp user to select a value from the list in the Clip wizard
  203. ^!Set %DefaultValue%=^?{Choose or enter a new default value=^%ValueList%}
  204. ;Insert the chosen value in the document, followed by a line break
  205. ^!SetPasteIndent Off
  206. ^!InsertText Default value = ^%DefaultValue%^p
  207. ;Change the default-value marker to match the item chosen by the user
  208. ^!Set %ValueList%=^$SetDefaultValue(^%ValueList%;^%DefaultValue%)$
  209. ;Prompt user to continue or end Clip
  210. ^!Continue Continue demonstration?
  211. ;Jump back to the start of the loop
  212. ^!Goto StartLoop
  213.  
  214. H="Play sound"
  215. ;Show Clip wizard with choice of system sounds, then play chosen sound. Some of these sounds may not work under Windows XP.
  216. ^!Sound ^?[Play Sound=SystemAsterisk|_SystemExclamation|SystemHand|SystemQuestion|SystemDefault]
  217.  
  218. H="Open multiple files"
  219. ;Sample code for displaying a Clip wizard with a File Open field "T=O", with possibility of selecting multiple files "S=M"
  220. ^!Open ^?[(T=O;S=M;F="Text Files (*.txt;*.ini)|*.txt;*.ini")Prompt]
  221.  
  222. H="Insert HRef link"
  223. ;Sample code for displaying a Clip wizard with a URL-tag field (T=T), and file filters matching HTML documents
  224. ^!InsertHtml <A ^?[(T=T;F="HTML Files|*.*htm*;*.asp;*.css")Link to web page]>^?[Link text=^&]</A>
  225.  
  226. H="Multiple fields"
  227. ;Show message
  228. ^!Continue This Clip will demonstrate various Wizard field types. The resulting output will be inserted into the current document. Continue?
  229. ;Create a new document
  230. ^!ToolBar New Document
  231. ;Display Clip wizard with various types of fields
  232. ^?[(T=W)&Memo Field with word wrap=This default text has^pseveral lines^p thanks to the use of^ptokens]
  233. ^?[&Prompt=List1^=Hello World^PMy name is Eric|List2^=Value2^Twith a tab|List3^=Three^pLines^Pfor you]
  234. ^?[(T=O;F="Text Files|*.txt;*.ini;*.*htm*")&Browse Field #1=c:\Windows\]
  235. <A ^?[(T=T;F="HTML Files|*.*htm*;*.asp;*.css")&Link to web page=c:\html\]>^?[Link &text=^&]</A>
  236. <IMG ^?[(T=T;C=L;F="Image Files|*.gif;*.jpg;*.jpeg")Link to &image=c:\html\] BORDER=0 ALT="^?[&Alt=^&]">
  237. ^?[(T=M;S=400;H=8)M&emo Field without word wrap]
  238. ^?[(M=">LL00;0;*")Mas&k Field]
  239.  
  240.  
  241. H="Insert file"
  242. ;Sample Clip demonstrating a prompt for inserting a file in the current document
  243. ^!InsertFile ^?{(T=O;F="Text Files|*.txt;*.ini;*.*htm*")Enter file name to insert=^$GetWinPath$}
  244.  
  245. H=";"
  246.  
  247.  
  248. H=";Arrays and Checkboxes"
  249.  
  250.  
  251. H="SetArray demo 1"
  252. ;Assign semicolon-delimited values to array variable
  253. ^!SetArray %Month%=January;February;March;April;May;June;July;August;September;October;November;December
  254. ;Prompt user to choose a month number
  255. ^!Set %MonthId%=^?[Choose a month number (1..12)=4]
  256. ;Show info window with month name corresponding to user's choice. The content of the array's indexed variable is used here
  257. ^!Info Month (#^%MonthId%) = ^%Month^%MonthId%%
  258.  
  259. H="SetArray demo 2"
  260. ;Assign semicolon-delimited values to array variable
  261. ^!SetArray %Names%=Cindy;Evelyn;Nicole
  262. ;Show content of array variable
  263. ^!Info 1. List of names:^P^P^%Names%
  264. ;Change the content of the second item in the array variable according to the user's input
  265. ^!Set %Names2%=^?{Change name #2=Kay}
  266. ;Show updated content of array variable
  267. ^!Info 2. List of names:^P^P^%Names%
  268.  
  269. H="SetArray demo 3"
  270. ;Assign all the file names chosen by the user into an array variable
  271. ^!SetArray %Files%=^?[(T=O;S=M;F="Text Files (*.txt;*.ini)|*.txt;*.ini")You can select several files]
  272. ;Copy the value representing the number of items into the Count variable. The variable at index 0 indicates the number of items in the array
  273. ^!Set %Count%=^%Files0%
  274. ;Initialize the Index variable to 0
  275. ^!Set %Index%=0
  276.  
  277. ;Beginning of loop
  278. :StartLoop
  279. ;Add one to the value contained in the variable Index
  280. ^!Inc %Index%
  281. ;End the Clip if the Index number is greater than the Count number
  282. ^!If ^%Index% > ^%Count% End
  283. ;Show the file name corresponding to the current index value. The content of the array's indexed variable is used here
  284. ^!Prompt File #^%Index% = ^%Files^%Index%%
  285. ;Jump back to the start of the loop
  286. ^!Goto StartLoop
  287.  
  288. H="SetListDelimiter"
  289. ;Define a list delimiter as two successive line breaks
  290. ^!SetListDelimiter ^p^p
  291. ;Loads all the text in the current document into the array variable. Each section of text separated by a blank line will be stored in its own indexed variable
  292. ^!SetArray %Array%=^$GetText$
  293. ;Prompt the user for a paragraph index number
  294. ^!Set %ParaIndex%=^?[Display paragraph #=4]
  295. ;Display the corresponding paragraph text in an info window
  296. ^!Info Paragraph (#^%ParaIndex%) = ^%NL%^%Array^%ParaIndex%%
  297.  
  298.  
  299. H=";----"
  300.  
  301.  
  302. H="CheckBoxes demo 1"
  303. ;Display checkbox list with Value2 and Value4 checked by default
  304. ^!Info ^?[(T=A)Prompt=Value1|_CheckedValue2|Value3|_CheckedValue4|Value5]
  305.  
  306. H="CheckBoxes demo 2"
  307. ;Change default delimiter to a blank space
  308. ^!SetListDelimiter " "
  309. ;Display checkbox list with Value2 and Value4 checked by default. The list displays a text that is different from the actual values
  310. ^!Info ^?{(T=A)Prompt=Value1^=V1|_CheckedValue2^=V2|Value3^=V3|_CheckedValue4^=V4|Value5^=V5}
  311.  
  312. H=";"
  313.  
  314.  
  315. H=";Loops"
  316.  
  317.  
  318. H="Loop demo 1"
  319. ;Demonstrates how loops can be created in Clip syntax
  320. ^!Continue This demonstrates Clip looping...
  321. ;Create a new document
  322. ^!ToolBar New Document
  323.  
  324. ;Beginning of loop
  325. :Start
  326. ;Insert text in document
  327. Paste Me!
  328.  
  329. ;Display prompt to user. If user confirms, next instruction is skipped
  330. ^!Skip Paste again?
  331. ;Ends Clip
  332. ^!GoTo End
  333. ;Jump back to the start of the loop
  334. ^!GoTo Start
  335.  
  336. H="Loop demo 2"
  337. ;Demonstrates how loops can be created in Clip syntax
  338. ^!Continue This demonstrates Clip looping...
  339. ;Create a new document
  340. ^!ToolBar New Document
  341. ;Copy value returned by Clip wizard to a variable
  342. ^!Set %Counter%=^?[Repeat count]
  343.  
  344. ;Beginning of loop
  345. :Start
  346. ;Test if value contained in variable is less than 1. End Clip if it is.
  347. ^!If ^%Counter% < 1 End
  348. ;Substract one from the value contained in the Counter variable
  349. ^!Dec Counter
  350. ;Insert text in document
  351. Paste Me!
  352.  
  353. ;Jump back to the start of the loop
  354. ^!GoTo Start
  355.  
  356. H="Address database"
  357. ;Creates a CSV list of address information
  358. ;Places cursor at the end of the text
  359. ^!Jump TEXT_END
  360.  
  361. ;Beginning of loop
  362. :Start
  363. ;Ask if user wants to add another address. End Clip if not
  364. ^!Continue Add an address?
  365. ;Display Clip wizard with address fields
  366. "^?{First Name}","^?{Last Name}","^?{Address 1}","^?{Address 2}","^?{City}","^?{State/Province}","^?{ZIP/Postal Code}","^?{Country}","^?{Phone}","^?{Fax}"
  367.  
  368. ;Jump back to the start of the loop
  369. ^!Goto Start
  370.  
  371. H="Loop tabs demo 1"
  372. ;Activates the first document in the tab bar
  373. ^!Document First
  374.  
  375. ;Beginning of loop
  376. :Start
  377. ;Ask if user wants to continue Clip
  378. ^!Continue Next document is now current. Continue?
  379. ;Activates the next document in the tab bar
  380. ^!Document Next
  381. ;End Clip if an error condition was generated (i.e. no more documents after the current one)
  382. ^!IfError End
  383. ;Jump back to the start of the loop
  384. ^!GoTo Start
  385.  
  386. H="Loop tabs demo 2"
  387. ;Initialize variable Index to 0
  388. ^!Set %Index%=0
  389.  
  390. ;Beginning of loop
  391. :LoopStart
  392. ;Add one to the value contained in the Index variable
  393. ^!Inc %Index%
  394. ;End Clip if the value contained in Index is greater to the number of open documents
  395. ^!If ^%Index% > ^$GetDocCount$ End
  396. ;Activate the specified document
  397. ^!SetDocIndex ^%Index%
  398. ;Ask if user wants to continue Clip
  399. ^!Continue Document changed (Index = ^%Index%). Continue?
  400. ;Jump back to the start of the loop
  401. ^!GoTo LoopStart
  402.  
  403. H=";"
  404.  
  405.  
  406. H=";Delimited Text"
  407. Demonstrates how NoteTab can be used to search and process text in delimited (tab, comma, or other) data files
  408.  
  409.  
  410. H="Copy field"
  411. ^!Continue This Clip will open a tab-delimited file and select the field that matches the specified coordinates. Continue?
  412. ;Opens file "Data.txt" in the Samples subdirectory
  413. ^!Open ^$GetSamplesPath$Data.txt
  414. ;Prompts user for field index to select, then copies field to the Clipboard
  415. ^!SetClipboard ^$GetField(^?[Row=13];^?[Column=2])$
  416.  
  417. H="Search fields"
  418. ^!Continue This Clip will open a tab-delimited file and select the field that matches the specified search criteria. Continue?
  419. ;Opens file "Data.txt" in the Samples subdirectory
  420. ^!Open ^$GetSamplesPath$Data.txt
  421. ;Copies the line count number to a variable
  422. ^!Set %MaxRow%=^$GetLineCount$
  423. ;Initialize variable Row to 0
  424. ^!Set %Row%=0
  425. ;Prompt user for field delimiter used in document (the sample file Data.txt uses tabs)
  426. ^!SetDelimiter ^?[(6;T=C)Field Delimiter==_Tab^=^t|Semi-colon^=;|Equal sign^==|SDF^="";""|None^=]
  427.  
  428. ;Beginning of loop
  429. :LoopStart
  430. ;Add one to the value contained in the Index variable
  431. ^!Inc %Row%
  432. ;End Clip if value contained in Row is greater than the value contained in MaxRow (i.e. Number of lines in document)
  433. ^!If ^%Row% > ^%MaxRow% End
  434. ;Prompt user for search criteria and store matched text position in variable
  435. ^!Set %Pos%=^$GetPosInField(^%Row%;^?[(2)Column=2];^?[(3)Whole word=_Yes^=|No^=T]^?[(4)Ignore case=_Yes^=I|No^=]^?[(5)Criteria must match...=Start of field^=S|Whole field^=W|_Any part of field^=];"^?[(1)Search criteria=America]")$
  436. ;If the value stored in Pos is greater than 0 (we have a match), jump to the next instruction otherwise return to start of loop
  437. ^!If ^%Pos% > 0 Next ELSE LoopStart
  438. ;Move the input focus to the current document
  439. ^!FocusDoc
  440.  
  441. H="Copy data column"
  442. ^!Continue This Clip will open a tab-delimited file and copy all the fields from the specified column. Continue?
  443. ;Opens file "Data.txt" in the Samples subdirectory
  444. ^!Open ^$GetSamplesPath$Data.txt
  445. ;Empty the content of the Clipboard
  446. ^!SetClipboard ^%Empty%
  447. ;Copies the line count number to a variable
  448. ^!Set %MaxRow%=^$GetLineCount$
  449. ;Initialize variable Row to 0
  450. ^!Set %Row%=0
  451. ;Prompt user for field delimiter used in document (the sample file Data.txt uses tabs)
  452. ^!SetDelimiter ^?[(2;T=C)Field Delimiter==_Tab^=^t|Semi-colon^=;|Equal^==|SDF^="";""|None^=]
  453.  
  454. ;Beginning of loop
  455. :LoopStart
  456. ;Add one to the value contained in the Index variable
  457. ^!Inc %Row%
  458. ;End loop if value contained in Row is greater than the value contained in MaxRow (i.e. Number of lines in document)
  459. ^!If ^%Row% > ^%MaxRow% EndLoop
  460. ;Place cursor at beginning of line
  461. ^!SetCursor ^%Row%:1
  462. ;Add field matching the user-chosen column to the Clipboard with line break
  463. ^!SetClipboard ^$GetClipboard$^$GetField(^?[(1)Column to copy=2])$^%NL%
  464. ;Jump back to the start of the loop
  465. ^!GoTo LoopStart
  466.  
  467. :EndLoop
  468. ;Paste contents of the Clipboard into a new document
  469. ^!Toolbar Paste New
  470.  
  471. H=";"
  472.  
  473.  
  474. H=";Miscellaneous"
  475.  
  476.  
  477. H="Help on current word"
  478. ;Copy word under cursor into a variable
  479. ^!Set %Word%=^$GetWord$
  480. ;If the variable is empty (i.e. there was no word under the cursor), jump to the label ShowInfo
  481. ^!IfTrue ^$IsEmpty(^%Word%)$ ShowInfo
  482. ;Show topic matching keyword in NoteTab Help file
  483. ^!Help "" ^%Word%
  484. ;End Clip
  485. ^!Goto End
  486. :ShowInfo
  487. ^!Prompt First put the cursor on a word. This Clip will attempt to find a matching topic in the Help file
  488.  
  489. H="Clip Help on current word"
  490. ;Place cursor on Clip command or function and activate this Clip to show Help
  491. ^!Set %Keyword%=^$GetWord$
  492. ^!If "^$StrCopyLeft("^%Keyword%";1)$" <> "$" IsCommand
  493. ^!If "^$StrCopyRight("^%Keyword%";1)$" = "$" ^!Set %Keyword%=^$StrDeleteRight("^%Keyword%";1)$
  494. ^!If "^%Keyword%" = "" Exit
  495. ^!Goto ShowHelp
  496.  
  497. :IsCommand
  498. ^!If "^%Keyword%" = "" Exit
  499. ^!Set %Keyword%=!^%Keyword%
  500.  
  501. :ShowHelp
  502. ^!Help "ClipCode.chm" ^%CARET%^%Keyword%
  503. ^!Keyboard ENTER
  504.  
  505. H="Open HTML template"
  506. ;Opens a template file for the creation of a web page
  507. ^!Open ^$GetTemplatePath$HTML.tpl
  508.  
  509. H="Get DOS output"
  510. ;Displays the output of the chosen DOS command to an info window
  511. ^!Info [L]^$GetDosOutput("^?[Dos output to display in Info window=dir c:\*.*]")$
  512.  
  513. H="Copy outline topics"
  514. ;If the current document is an outline, start the procedure. Otherwise ask whether to demonstrate the feature on the Readme.otl document, which is part of the NoteTab package
  515. ^!IfFalse ^$IsOutlineDoc$ OpenReadme
  516. ;Jump to the Start label
  517. ^!GoTo Start
  518.  
  519. :OpenReadme
  520. ;Open the Readme.otl document
  521. ^!Open ^$GetAppPath$Readme.Otl
  522. ;If there was an error while trying to open it, show message and end procedure
  523. ^!IfError Error
  524.  
  525. :Start
  526. ;Initialize variable TopicIndex to 0
  527. ^!Set %TopicIndex%=0
  528. ;Store the topics count in a variable
  529. ^!Set %TopicCount%=^$GetTopicCount$
  530. ;Empty the content of the Clipboard
  531. ^!SetClipboard ^%Empty%
  532.  
  533. :LoopStart
  534. ;Add one to the value contained in the TopicIndex variable
  535. ^!Inc %TopicIndex%
  536. ;Jump to PasteTopics label if TopicIndex is greater than TopicCount
  537. ^!If ^%TopicIndex% > ^%TopicCount% PasteTopics
  538. ;Make the outline topic that matches the value in TopicIndex active
  539. ^!SetTopicIndex ^%TopicIndex%
  540. ;Add the name of the active outline topic and a line break to the Clipboard
  541. ^!SetClipboard ^$GetClipboard$^$GetTopicName$^%NL%
  542. ;Jump back to the start of the loop
  543. ^!GoTo LoopStart
  544.  
  545. :Error
  546. ;Show error message
  547. ^!Prompt Error: the current document is not an outline
  548. ;End Clip
  549. ^!GoTo End
  550.  
  551. :PasteTopics
  552. ;Paste contents of the Clipboard into a new document
  553. ^!Toolbar Paste New
  554.  
  555. H="Open EBCDIC file"
  556. ;Prompts user to choose an EBCDIC file(s) and opens in NoteTab
  557. ^!OpenEbcdic ^?{(T=O;S=M;F="EBCDIC files (*.cbl;*.cob;*.cpy;*.ddl;*.bms)|*.cbl;*.cob;*.cpy;*.ddl;*.bms")Open EBCDIC file(s)=^$GetSamplesPath$Ebcdic.cob} /W=^?{LRECL=Variable Width^=0|80|_100|132|133}
  558.  
  559. H="Export document"
  560. ;Clip demonstrating the Export command
  561. ^!Export "^?[(T=S;F="Text Files|*.txt;*.ini;*.*htm*")File Name=c:\Temp\]" ^?[Character Set=ASCII|_ANSI] ^?[Format=_PC|MAC|UNIX|EBCDIC] ^?[Text=SELECTION|_ALL] ^?[Hard-break word wrap=_No^= |Yes^=HARDBREAKS]
  562.  
  563. H="NoteTab name and version"
  564. ;Clip functions to extract NoteTab program name and version
  565. ^!Info ^$GetProgName$ (version ^$GetProgVersion$)
  566.  
  567. H="Show paragraph"
  568. ;Demonstrates the GetParagraph function
  569. ^!Info ^$GetParagraph(^?[Display paragraph #=2])$
  570.  
  571. H="FarClip demo 1"
  572. ;Demonstrates the FarClip command. This will activate the Clip labeled "Center" in the HTML.clb library file
  573. ^!FarClip HTML:Center
  574.  
  575. H="FarClip demo 2"
  576. ;Demonstrates the FarClip command. This will activate the Clip labeled "Show Date" in the Samples\FarClips.dat library file
  577. ^!FarClip "^$GetSamplesPath$FarClips.dat:"Show Date""
  578.  
  579. H="Set bookmark"
  580. ;Check if editor type is NoteTab Light/Std. If it is, show error message (Bookmarks are only supported in NoteTab Pro)
  581. ^!IfSame ^$GetEditorType$ nts SntError
  582. ;Prompt user for bookmark number and set bookmark accordingly
  583. ^!SetBookmark ^?{Set Bookmark #=_1|2|3|4|5|6|7|8|9|0}
  584. ;Finish the Clip by jumping to the EndClip label
  585. ^!GoTo EndClip
  586.  
  587. :SntError
  588. ^!Prompt Sorry, bookmarks only work with NoteTab Pro!
  589.  
  590. :EndClip
  591. ;Move the input focus to the current document
  592. ^!FocusDoc
  593.  
  594. H="Go to bookmark"
  595. ;Check if editor type is NoteTab Light/Std. If it is, show error message (Bookmarks are only supported in NoteTab Pro)
  596. ^!IfSame ^$GetEditorType$ nts SntError
  597. ;Prompt user for bookmark number and move cursor to it if it exists
  598. ^!GotoBookmark ^?{Go to Bookmark #=_1|2|3|4|5|6|7|8|9|0}
  599. ;Finish the Clip by jumping to the EndClip label
  600. ^!GoTo EndClip
  601.  
  602. :SntError
  603. ^!Prompt Sorry, bookmarks only work with NoteTab Pro!
  604.  
  605. :EndClip
  606. ;Move the input focus to the current document
  607. ^!FocusDoc
  608.